<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app"></div>
    <template id="t1">
      <div>
        <p style="color: red; font-size: 3rem; border: solid">hello jack</p>
        <!-- <p :style="'color: red; font-size: 3rem; border: solid'">hello jack</p> -->
        <!-- <p :style="{color:'red',fontSize:'3rem',border:'solid'}">hello jack</p> -->
        <!-- <p :style="{color:cl,fontSize:'3rem',border:'solid'}">hello jack</p> -->
        <!-- <p :style="style">hello jack</p> -->

        <!-- <p
          :style="[
        {color:cl,fontSize:'3rem',border:'solid'},
        {color:cl,fontSize:'3rem',border:'solid'},
        {color:cl,fontSize:'3rem',border:'solid'},
        ]"
        >
          hello jack
        </p> -->
        <p :style="styleArr">hello jack</p>
      </div>
    </template>
    <script src="./vue.js"></script>
    <script>
      /*

      style 支持的值类型有：
      1. 字符串
      2. 对象，每一个属性代表一个样式，如果属性是多单词，可以是小驼峰命名法替代 fontSize。
      3. 数组，每一个数组元素都是一个定义了多个内联样式的对象，本质上是将数组元素拼接成一个对象，同名属性互相覆盖，后面属性覆盖前面属性。 
      */
      const vm = new Vue({
        el: "#app",
        template: "#t1",
        data: {
          cl: "red",
          style: { color: "red", fontSize: "3rem", border: "solid" },
          styleArr: [
            { color: "red", fontSize: "3rem", border: "solid" },
            { color: "red", fontSize: "3rem", border: "solid" },
            { color: "green", fontSize: "3rem", border: "solid" },
          ],
        },
        created() {
          setTimeout(() => {
            this.cl = "green";
          }, 3000);
        },
      });
    </script>
  </body>
</html>
